<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>{extends}</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Smarty 3 Manual">
<link rel="up" href="language.builtin.functions.html" title="Chapter 7. Built-in Functions">
<link rel="prev" href="language.function.debug.html" title="{debug}">
<link rel="next" href="language.function.for.html" title="{for}">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">{extends}</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="language.function.debug.html">Prev</a> </td>
<th width="60%" align="center">Chapter 7. Built-in Functions</th>
<td width="20%" align="right"> <a accesskey="n" href="language.function.for.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="{extends}">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="language.function.extends"></a>{extends}</h2></div></div></div>
<p>
  <code class="varname">{extends}</code> tags are used in child templates in template inheritance for extending parent templates.
  For details see section of <a class="link" href="advanced.features.template.inheritance.html" title="Template Inheritance">Template Interitance</a>.
  </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
   The <code class="varname">{extends}</code> tag must be on the first line of the template.
  </p></li>
<li class="listitem"><p>
    If a child template extends a parent template with the <code class="varname">{extends}</code> tag it may contain only <code class="varname">{block}</code> tags.
    Any other template content is ignored.    
   </p></li>
<li class="listitem"><p>
  Use the syntax for <a class="link" href="resources.html" title="Chapter 16. Resources">template resources</a> to extend files outside of the
  <a class="link" href="variable.template.dir.html" title="$template_dir"><em class="parameter"><code>$template_dir</code></em></a>  directory.
  </p></li>
</ul></div>
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
     When extending a variable parent like <code class="literal">{extends file=$parent_file}</code>, 
     make sure you include <code class="varname">$parent_file</code> in the 
     <a class="link" href="variable.cache.id.html" title="$cache_id"><code class="varname">$cache_id</code></a>. Otherwise Smarty
     cannot distinguish between different <code class="varname">$parent_file</code>s.
   </p>
</div>
<p><span class="bold"><strong>Attributes:</strong></span></p>
<div class="informaltable"><table border="1">
<colgroup>
<col align="center">
<col align="center">
<col align="center">
<col align="center">
<col>
</colgroup>
<thead><tr>
<th align="center">Attribute Name</th>
<th align="center">Type</th>
<th align="center">Required</th>
<th align="center">Default</th>
<th>Description</th>
</tr></thead>
<tbody><tr>
<td align="center">file</td>
<td align="center">string</td>
<td align="center">Yes</td>
<td align="center"><span class="emphasis"><em>n/a</em></span></td>
<td>The name of the template file which is extended</td>
</tr></tbody>
</table></div>
<div class="example">
<a name="id370113"></a><p class="title"><b>Example 7.26. Simple {extends} example</b></p>
<div class="example-contents"><pre class="programlisting">

{extends file='parent.tpl'}
{extends 'parent.tpl'}  {* short-hand *}

  </pre></div>
</div>
<br class="example-break"><p>
  See also
  <a class="link" href="advanced.features.template.inheritance.html" title="Template Inheritance">Template Interitance</a>
  and <a class="link" href="language.function.block.html" title="{block}"><code class="varname">{block}</code></a>.
 </p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="language.function.debug.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="language.builtin.functions.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="language.function.for.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">{debug} </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> {for}</td>
</tr>
</table>
</div>
</body>
</html>
